package feed;
//class Item { def title; def contents; String toString() { return title; } }

class FeedStream {
    def enumeration 

    public FeedStream()
    {

        def rssFile = "data/FeedStream.xml"
        try {
          //println "parsing file ${rssFile}";
          def rss = new XmlParser().parse(new File(rssFile));
          def items = new Vector();
          rss.channel.item.each() {
	    def item = new Item(title:it.title[0].text(), 
			    contents:it.description[0].text());
	    items.add(item);
          }
          enumeration = items.elements()
	  println "enumeration : ${enumeration}, ${items.size()}"
        } catch (Exception e) {
          println "Error during <${rssFile}> RSS parse: ${e}";
        }
    }
    String next()
    {
        if(enumeration.hasMoreElements())
        	return ((Item)enumeration.nextElement()).title
        return "";
    }
}

